﻿using Blog.Application.Condition;
using Blog.Application.DTO;
using Blog.Application.Service;
using Core.Common.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlogWebApi.Controllers
{
    [Route("api/friendlink")]
    [ApiController]
    public class FriendLinkController : ControllerBase
    {
        private IFriendLinkService _friendLinkService;
        public FriendLinkController(IFriendLinkService friendLinkService)
        {
            _friendLinkService = friendLinkService;
        }
        [HttpGet("list")]
        public ApiResult GetFriendLinks()
        {
            List<FriendLinkDTO> friendLinkDTOs = _friendLinkService.GetFriendLinks();
            return ApiResult.Success(friendLinkDTOs);
        }
        [HttpPost("add")]
        public ApiResult Apply([FromBody]FriendLinkDTO friendLinkDTO)
        {
            _friendLinkService.Apply(friendLinkDTO);
            return ApiResult.Success();
        }
    }
}
